package com.qrpay.model.enums;

/**
 * 记账场景类型
 */
public enum AccountingScenario {

    Recharge("Recharge", "充值"),
    Withdraw("Withdraw", "提现"),
    AgentPay("AgentPay", "代付"),
    AgentPayRefund("AgentPayRefund", "代付退款"),

    QrPayFee("QrPayFee", "二维码支付手续费"),
    QrPayFeeRefund("QrPayFeeRefund", "二维码支付手续费退还"),
    BuyVip("BuyVip", "购买Vip会员"),
    BuyVipRefund("BuyVipRefund", "购买Vip会员退款"),
    UpdateVip("UpdateVip", "变更Vip会员"),
    UpdateVipRefund("UpdateVipRefund", "变更Vip会员退款"),

    Settle("Settle", "子用户清算分佣"),
    ;

    private final String code;
    private final String desc;

    AccountingScenario(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public boolean equals(String code) {
        return this.code.equals(code);
    }

    public static AccountingScenario byCode(String code) {
        for (AccountingScenario t : values()) {
            if (t.equals(code)) return t;
        }
        return null;
    }
}
